package page.app.messageActivityIndex;

import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.ExpectedConditions;

import basicTool.WaitTool;
import io.appium.java_client.AppiumDriver;
import page.app.AbstractAppPage;

public class InvestArticlesIndexPage extends AbstractAppPage {

	@FindBy(xpath = "//android.view.View[@content-desc='全部']|//UIAStaticText[@name='全部']")
	private WebElement allTab;
	
	@FindBy(xpath = "//android.view.View[@content-desc='官方']|//UIAStaticText[@name='官方']")
	private WebElement guanfangTab;
	
	@FindBy(xpath = "//android.view.View[@content-desc='攻略']|//UIAStaticText[@name='攻略']")
	private WebElement gonglueTab;
	
	@FindBy(xpath = "//android.view.View[@content-desc='理财']|//UIAStaticText[@name='理财']")
	private WebElement licaiTab;
	
	@FindBy(xpath = "//android.view.View[@content-desc='企业']|//UIAStaticText[@name='企业']")
	private WebElement qiyeTab;
	
	@FindBy(xpath = "//android.webkit.WebView/android.view.View[@index=1]|//UIAWebView/UIAStaticText[7]")
	private WebElement firstArticle;
	
    @FindBy(xpath = "//android.widget.TextView[@text='投稿']")
	private WebElement submissionButton;
    
	public InvestArticlesIndexPage(AppiumDriver appiumDriver) {
		super(appiumDriver);
		WaitTool.waitFor(appiumDriver, ExpectedConditions.visibilityOf(allTab), DefaultWaitElementTime4Page);
	}
	


	public InvestArticlesDetailPage clickfirstArticle() throws Exception {
		return click(firstArticle, InvestArticlesDetailPage.class);
	}
	
	public WebElement clickguanfangTab() throws Exception{
		
        return click(guanfangTab, firstArticle);

    }
	
	public WebElement clickgonglueTab() throws Exception{
		
        return click(gonglueTab, firstArticle);

    }

	public WebElement clicklicaiTab() throws Exception{
		
        return click(licaiTab, firstArticle);

    }
	

}
